package com.ffdms.vo;

import android.database.Cursor;

public class Message {
	public static final String TABLENAME = "Message";
	public static final String COLUMN_ID = "id";
	public static final String COLUMN_TITLE = "title";
	public static final String COLUMN_DESCRIPTION = "description";
	public static final String COLUMN_SENDER = "sender";
	public static final String COLUMN_SENDTIME = "sendTime";
	public static final String COLUMN_STATUS = "status";
	public static final String COLUMN_ENTERPRISEID = "enterpriseID";
	public static final String COLUMN_ADDTIME = "addTime";
	public static final String COLUMN_MODIFYTIME = "modifyTime";
	public static final String[] ALLCOLUMNS = new String[] { COLUMN_ID,
			COLUMN_TITLE, COLUMN_DESCRIPTION, COLUMN_SENDER, COLUMN_SENDTIME,
			COLUMN_STATUS, COLUMN_ENTERPRISEID, COLUMN_ADDTIME,
			COLUMN_MODIFYTIME };
	public static final String CREATE_TABLE_SQL = String.format(
			"CREATE TABLE %s(" + "%s INTEGER PRIMARY KEY AUTOINCREMENT,"
					+ "%s TEXT NULL,"
					+ "%s TEXT NULL,"
					+ "%s INTEGER NOT NULL,"
					+ "%s TEXT NULL," 
					+ "%s INTEGER NULL,"
					+ "%s INTEGER NOT NULL,"
					+ "%s TEXT NULL,"
					+ "%s TEXT NULL)", TABLENAME, COLUMN_ID,
			COLUMN_TITLE, COLUMN_DESCRIPTION, COLUMN_SENDER, COLUMN_SENDTIME,
			COLUMN_STATUS, COLUMN_ENTERPRISEID, COLUMN_ADDTIME,
			COLUMN_MODIFYTIME);

	private int iD;
	private String title;
	private String description;
	private int sender;
	private String sendTime;
	private int status;
	private int enterpriseID;
	private String addTime;
	private String modifyTime;

	public int getiD() {
		return iD;
	}

	public void setiD(int iD) {
		this.iD = iD;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getSender() {
		return sender;
	}

	public void setSender(int sender) {
		this.sender = sender;
	}

	public String getSendTime() {
		return sendTime;
	}

	public void setSendTime(String sendTime) {
		this.sendTime = sendTime;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public int getEnterpriseID() {
		return enterpriseID;
	}

	public void setEnterpriseID(int enterpriseID) {
		this.enterpriseID = enterpriseID;
	}

	public String getAddTime() {
		return addTime;
	}

	public void setAddTime(String addTime) {
		this.addTime = addTime;
	}

	public String getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(String modifyTime) {
		this.modifyTime = modifyTime;
	}
	
	public Message valueOf(Cursor c){
		this.iD = c.getInt(c.getColumnIndex(Message.COLUMN_ID));
		this.title = c.getString(c.getColumnIndex(Message.COLUMN_TITLE));
		this.addTime = c.getString(c.getColumnIndex(Message.COLUMN_ADDTIME));
		this.description = c.getString(c.getColumnIndex(Message.COLUMN_DESCRIPTION));
		this.enterpriseID = c.getInt(c.getColumnIndex(Message.COLUMN_ENTERPRISEID));
		this.modifyTime = c.getString(c.getColumnIndex(Message.COLUMN_MODIFYTIME));
		this.sender = c.getInt(c.getColumnIndex(Message.COLUMN_SENDER));
		this.status = c.getInt(c.getColumnIndex(Message.COLUMN_STATUS));
		this.sendTime = c.getString(c.getColumnIndex(Message.COLUMN_SENDTIME));
		return this;
	}
}
